package com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firewater;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseService;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.utils.requestutil.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class WaterDeviceService extends BaseService {

	private static final Logger logger = LoggerFactory.getLogger(WaterDeviceService.class);


	/**
	 * 设备添加
	 * @param
	 * @return
	 */
	public RespEntity add(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return firewaterJava(jsonParam,"add","device");
	}

	/**
	 * 设备删除
	 * @param
	 * @return
	 */
	public RespEntity delete(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return firewaterJava(jsonParam,"delete","device");
	}

	/**
	 * 设备修改
	 * @param
	 * @return
	 */
	public RespEntity update(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return firewaterJava(jsonParam,"update","device");
	}

	/**
	 * 设备列表
	 * @param
	 * @return
	 */
	public RespEntity deviceListPage(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return firewater(jsonParam,"deviceListPage","device");
	}

	/**
	 * 设备详情
	 * @param
	 * @return
	 */
	public RespEntity detail(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return firewater(jsonParam,"detail","device");
	}

	/**
	 * 设备检测Rest接口
	 * @param
	 * @return
	 */
	public RespEntity data(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return firewater(jsonParam,"data","device");
	}

}
